<!--
/******************************************************************************
  @file   QGPE.xml
  @brief  Gaming Performance Engine xml

  DESCRIPTION
      Each feature has an xml file to define the feature components

  ===========================================================================
  Copyright (c) 2021 Qualcomm Technologies, Inc.
  All Rights Reserved.
  Confidential and Proprietary - Qualcomm Technologies, Inc.
  ===========================================================================
******************************************************************************/
-->
<!--
    Follows "Data goes into elements, metadata goes into attributes"
 -->

<Feature>
    <Name>APEngine</Name>
    <Libname>libapengine.so</Libname>
    <Configs target="taro">
        <STUTTER_SCALE>10</STUTTER_SCALE>
        <THERMAL_MONITOR>1</THERMAL_MONITOR>
        <THERMAL_MONITOR_RULES>GAME_OPT_TSENS_RULE1,GAME_OPT_TSENS_RULE2,GAME_OPT_TSENS_RULE3</THERMAL_MONITOR_RULES>
        <!-- FPS threshold values in the order: Increase, Aggressive Increase, Decrease -->
        <FPS_30_THRESHOLD>0.6, 1.0, 0.4</FPS_30_THRESHOLD>
        <FPS_35_THRESHOLD>0.6, 1.0, 0.4</FPS_35_THRESHOLD>
        <FPS_40_THRESHOLD>0.6, 1.0, 0.4</FPS_40_THRESHOLD>
        <FPS_60_THRESHOLD>0.6, 1.0, 0.4</FPS_60_THRESHOLD>
        <FPS_90_THRESHOLD>2.0, 5.0, 1.0</FPS_90_THRESHOLD>
        <FPS_120_THRESHOLD>2.0, 5.0, 1.0</FPS_120_THRESHOLD>
        <FPS_144_THRESHOLD>2.0, 5.0, 1.0</FPS_144_THRESHOLD>
        <GROUP_UPMIGRATE_PATH>/proc/sys/walt/sched_group_upmigrate</GROUP_UPMIGRATE_PATH>
        <GROUP_DOWNMIGRATE_PATH>/proc/sys/walt/sched_group_downmigrate</GROUP_DOWNMIGRATE_PATH>
        <BIG_CLUSTER_ID>4,5,6,7</BIG_CLUSTER_ID>
    </Configs>

    <Configs target="cape">
        <STUTTER_SCALE>10</STUTTER_SCALE>
        <THERMAL_MONITOR>1</THERMAL_MONITOR>
        <THERMAL_MONITOR_RULES>GAME_OPT_TSENS_RULE1,GAME_OPT_TSENS_RULE2,GAME_OPT_TSENS_RULE3</THERMAL_MONITOR_RULES>
        <!-- FPS threshold values in the order: Increase, Aggressive Increase, Decrease -->
        <FPS_30_THRESHOLD>0.6, 1.0, 0.4</FPS_30_THRESHOLD>
        <FPS_35_THRESHOLD>0.6, 1.0, 0.4</FPS_35_THRESHOLD>
        <FPS_40_THRESHOLD>0.6, 1.0, 0.4</FPS_40_THRESHOLD>
        <FPS_60_THRESHOLD>0.6, 1.0, 0.4</FPS_60_THRESHOLD>
        <FPS_90_THRESHOLD>2.0, 5.0, 1.0</FPS_90_THRESHOLD>
        <FPS_120_THRESHOLD>2.0, 5.0, 1.0</FPS_120_THRESHOLD>
        <FPS_144_THRESHOLD>2.0, 5.0, 1.0</FPS_144_THRESHOLD>
        <FPS_165_THRESHOLD>2.0, 5.0, 1.0</FPS_165_THRESHOLD>
        <GROUP_UPMIGRATE_PATH>/proc/sys/walt/sched_group_upmigrate</GROUP_UPMIGRATE_PATH>
        <GROUP_DOWNMIGRATE_PATH>/proc/sys/walt/sched_group_downmigrate</GROUP_DOWNMIGRATE_PATH>
        <BIG_CLUSTER_ID>4,5,6,7</BIG_CLUSTER_ID>
    </Configs>

    <Configs target="ukee">
        <STUTTER_SCALE>10</STUTTER_SCALE>
        <THERMAL_MONITOR>1</THERMAL_MONITOR>
        <THERMAL_MONITOR_RULES>GAME_OPT_TSENS_RULE1,GAME_OPT_TSENS_RULE2,GAME_OPT_TSENS_RULE3</THERMAL_MONITOR_RULES>
        <!-- FPS threshold values in the order: Increase, Aggressive Increase, Decrease -->
        <FPS_30_THRESHOLD>0.6, 1.0, 0.4</FPS_30_THRESHOLD>
        <FPS_35_THRESHOLD>0.6, 1.0, 0.4</FPS_35_THRESHOLD>
        <FPS_40_THRESHOLD>0.6, 1.0, 0.4</FPS_40_THRESHOLD>
        <FPS_60_THRESHOLD>0.6, 1.0, 0.4</FPS_60_THRESHOLD>
        <FPS_90_THRESHOLD>2.0, 5.0, 1.0</FPS_90_THRESHOLD>
        <FPS_120_THRESHOLD>2.0, 5.0, 1.0</FPS_120_THRESHOLD>
        <FPS_144_THRESHOLD>2.0, 5.0, 1.0</FPS_144_THRESHOLD>
        <GROUP_UPMIGRATE_PATH>/proc/sys/walt/sched_group_upmigrate</GROUP_UPMIGRATE_PATH>
        <GROUP_DOWNMIGRATE_PATH>/proc/sys/walt/sched_group_downmigrate</GROUP_DOWNMIGRATE_PATH>
        <BIG_CLUSTER_ID>4,5,6,7</BIG_CLUSTER_ID>
    </Configs>

    <Configs target="diwali">
        <STUTTER_SCALE>10</STUTTER_SCALE>
        <GROUP_UPMIGRATE_PATH>/proc/sys/walt/sched_group_upmigrate</GROUP_UPMIGRATE_PATH>
        <GROUP_DOWNMIGRATE_PATH>/proc/sys/walt/sched_group_downmigrate</GROUP_DOWNMIGRATE_PATH>
        <BIG_CLUSTER_ID>4,5,6,7</BIG_CLUSTER_ID>
    </Configs>

    <Profiles>
        <Profile target="taro">
            <!-- Colocation v3 1 GHz-->
            <PROACTIVE_DEFAULT>
                0x4144C100,1000000
            </PROACTIVE_DEFAULT>
            <PROACTIVE_SKEW2>
                0x4144C100,1000000
            </PROACTIVE_SKEW2>
            <!-- Heavy Game Default -->
            <!-- SCHED_MIN_TASK_UTIL_FOR_COLOCATION, 0, SCHED_MIN_TASK_UTIL_FOR_BOOST, 0 -->
            <!-- MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_BIG, 19000, MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_LITTLE, 19000 -->
            <ADAPTIVE_PROFILE0>
                0x40C78000, 0, 0x40C7C000, 0,
                0x41448000, 19000, 0x41448100, 19000
            </ADAPTIVE_PROFILE0>
            <!-- Agressive Profile - Junk detected -->
            <!-- SCHED_MIN_TASK_UTIL_FOR_COLOCATION, 0, SCHED_MIN_TASK_UTIL_FOR_BOOST, 0 -->
            <!-- MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_BIG, 79000, MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_LITTLE, 79000-->
            <!-- CPU_LLCC_BW_MIN_FREQ_V2, 30, LLCC_DDR_BW_MIN_FREQ_V2, 90, L3_MEMLAT_MIN_FREQ, 900000 -->
            <!-- MIN_FREQ_CLUSTER_PRIME_CORE_0, 1000, MIN_FREQ_CLUSTER_BIG_CORE_0, 1000, MIN_FREQ_CLUSTER_LITTLE_CORE_0, 1000 -->
            <!-- TO BE REPLACED: SCHED_BUSY_HYSTERSIS_CPU_MASK, 0xf0, LPM_BIAS_HYST, 99-->
            <ADAPTIVE_PROFILE1>
                0x40C78000, 0, 0x40C7C000, 0,
                0x41448000, 79000, 0x41448100, 79000,
                0x41844000, 30, 0x4303C000, 90, 0x43480000, 900000,
                0x40800200, 1000, 0x40800000, 1000, 0x40800100, 1000,
                0x40C74000, 0xf0, 0x40408000, 99
            </ADAPTIVE_PROFILE1>
            <!-- MIN_FREQ_CLUSTER_PRIME_CORE_0 1651, MIN_FREQ_CLUSTER_BIG_CORE_0 1651 -->
            <PREDICTIVE_PROFILE1>
                0x40800200,1651,0x40800000,1651
            </PREDICTIVE_PROFILE1>
            <!-- MIN_FREQ_CLUSTER_LITTLE_CORE_0 1324 -->
            <PREDICTIVE_PROFILE2>
                0x40800100,1324
            </PREDICTIVE_PROFILE2>
        </Profile>

        <Profile target="cape">
            <!-- Colocation v3 1 GHz-->
            <PROACTIVE_DEFAULT>
                0x4144C100,1000000
            </PROACTIVE_DEFAULT>
            <PROACTIVE_SKEW2>
                0x4144C100,1000000
            </PROACTIVE_SKEW2>
            <!-- Heavy Game Default -->
            <!-- SCHED_MIN_TASK_UTIL_FOR_COLOCATION, 0, SCHED_MIN_TASK_UTIL_FOR_BOOST, 0 -->
            <!-- MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_BIG, 19000, MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_LITTLE, 19000 -->
            <ADAPTIVE_PROFILE0>
                0x40C78000, 0, 0x40C7C000, 0,
                0x41448000, 19000, 0x41448100, 19000
            </ADAPTIVE_PROFILE0>
            <!-- Agressive Profile - Junk detected -->
            <!-- SCHED_MIN_TASK_UTIL_FOR_COLOCATION, 0, SCHED_MIN_TASK_UTIL_FOR_BOOST, 0 -->
            <!-- MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_BIG, 79000, MPCTLV3_SCHEDUTIL_DOWN_RATE_LIMIT_CLUSTER_LITTLE, 79000-->
            <!-- CPU_LLCC_BW_MIN_FREQ_V2, 30, LLCC_DDR_BW_MIN_FREQ_V2, 90, L3_MEMLAT_MIN_FREQ, 900000 -->
            <!-- MIN_FREQ_CLUSTER_PRIME_CORE_0, 1000, MIN_FREQ_CLUSTER_BIG_CORE_0, 1000, MIN_FREQ_CLUSTER_LITTLE_CORE_0, 1000 -->
            <!-- TO BE REPLACED: SCHED_BUSY_HYSTERSIS_CPU_MASK, 0xf0, LPM_BIAS_HYST, 99-->
            <ADAPTIVE_PROFILE1>
                0x40C78000, 0, 0x40C7C000, 0,
                0x41448000, 79000, 0x41448100, 79000,
                0x41844000, 30, 0x4303C000, 90, 0x43480000, 900000,
                0x40800200, 1000, 0x40800000, 1000, 0x40800100, 1000,
                0x40C74000, 0xf0, 0x40408000, 99
            </ADAPTIVE_PROFILE1>
            <!-- MIN_FREQ_CLUSTER_PRIME_CORE_0 1651, MIN_FREQ_CLUSTER_BIG_CORE_0 1651 -->
            <PREDICTIVE_PROFILE1>
                0x40800200,1651,0x40800000,1651
            </PREDICTIVE_PROFILE1>
            <!-- MIN_FREQ_CLUSTER_LITTLE_CORE_0 1324 -->
            <PREDICTIVE_PROFILE2>
                0x40800100,1324
            </PREDICTIVE_PROFILE2>
        </Profile>

        <Profile target="diwali">
            <!-- CORE_CTL_ENABLE_BIG, 0, CORE_CTL_ENABLE_PRIME, 0-->
            <!-- SCHED_MIN_TASK_UTIL_FOR_COLOCATION, 5, SCHED_MIN_TASK_UTIL_FOR_BOOST, 5-->
            <!-- BUS_DCVS_LLCC_DDR_GOLD_LAT_EN_SPM_VOTE, 30, BUS_DCVS_LLCC_DDR_GOLD_LAT_EN_SPM_VOTE, 30-->
            <!-- CPU_LLCC_BW_MAX_FREQ_V2 resource opcode, value-->
            <!-- SCHED_MANY_WAKE_UP, 4-->
            <PROACTIVE_DEFAULT>
                0x41008000, 0, 0x41008200, 0,
                0x40C78000, 5, 0x40C7C000, 5,
                0x43490000, 30, 0x43494000, 30,
                0x41848000, 0xE3C88,
                0x40C9C000,4
            </PROACTIVE_DEFAULT>
            <!-- CORE_CTL_ENABLE_BIG, 0, CORE_CTL_ENABLE_PRIME, 0-->
            <!-- SCHED_MIN_TASK_UTIL_FOR_COLOCATION, 5, SCHED_MIN_TASK_UTIL_FOR_BOOST, 5-->
            <!-- BUS_DCVS_LLCC_DDR_GOLD_LAT_EN_SPM_VOTE, 30, BUS_DCVS_LLCC_DDR_GOLD_LAT_EN_SPM_VOTE, 30-->
            <!-- CPU_LLCC_BW_MAX_FREQ_V2 resource opcode, value-->
            <!-- SCHED_MANY_WAKE_UP, 4-->
            <PROACTIVE_SKEW2>
                0x41008000, 0, 0x41008200, 0,
                0x40C78000, 5, 0x40C7C000, 5,
                0x43490000, 30, 0x43494000, 30,
                0x41848000, 0xE3C88,
                0x40C9C000,4
            </PROACTIVE_SKEW2>
            <!-- MIN_FREQ_CLUSTER_PRIME_CORE_0 1651, MIN_FREQ_CLUSTER_BIG_CORE_0 1651 -->
            <PREDICTIVE_PROFILE1>
                0x40800200,1651,0x40800000,1651
            </PREDICTIVE_PROFILE1>
            <!-- MIN_FREQ_CLUSTER_LITTLE_CORE_0 1324 -->
            <PREDICTIVE_PROFILE2>
                0x40800100,1324
            </PREDICTIVE_PROFILE2>
            <!-- GPU MIN_FREQUENCY resource opcode,value-->
            <PREDICTIVE_PROFILE3>
                0x42804000,0
            </PREDICTIVE_PROFILE3>
            <!-- DDR_LAT_MIN_FREQ_GOLD resource opcode,value-->
            <PREDICTIVE_PROFILE4>
                0x43488000,2092000
            </PREDICTIVE_PROFILE4>
            <!-- SCHED_LOAD_BOOST GOLD resource opcode,value-->
            <PREDICTIVE_PROFILE5>
                0x40C68000, -3
            </PREDICTIVE_PROFILE5>
        </Profile>
    </Profiles>

    <Meters>
        <SamplesRequired>4</SamplesRequired>

        <Meter>
            <Name>Fps</Name>
            <Triggers>
                <Trigger>
                   <Primary>true</Primary>
                   <AsyncId>VENDOR_HINT_ACTIVITY_START</AsyncId>
                   <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                    <Primary>true</Primary>
                    <AsyncId>VENDOR_HINT_ACTIVITY_PAUSE</AsyncId>
                    <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                    <Primary>true</Primary>
                    <AsyncId>VENDOR_HINT_ACTIVITY_RESUME</AsyncId>
                    <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                   <Primary>true</Primary>
                   <AsyncId>VENDOR_HINT_ACTIVITY_STOP</AsyncId>
                   <AsyncType>-1</AsyncType>
                </Trigger>

            </Triggers>

            <Configs>
                <FPS_NODE>/sys/class/drm/sde-crtc-0/measured_fps</FPS_NODE>
                <FPS_PERIODICITY_NODE>/sys/class/drm/sde-crtc-0/fps_periodicity_ms</FPS_PERIODICITY_NODE>
            </Configs>
            <Samples>100</Samples>
        </Meter>

        <Meter>
            <Name>SchedParams</Name>
            <Triggers>
                <Trigger>
                   <Primary>true</Primary>
                   <AsyncId>VENDOR_HINT_ACTIVITY_START</AsyncId>
                   <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                    <Primary>true</Primary>
                    <AsyncId>VENDOR_HINT_ACTIVITY_PAUSE</AsyncId>
                    <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                    <Primary>true</Primary>
                    <AsyncId>VENDOR_HINT_ACTIVITY_RESUME</AsyncId>
                    <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                   <Primary>true</Primary>
                   <AsyncId>VENDOR_HINT_ACTIVITY_STOP</AsyncId>
                   <AsyncType>-1</AsyncType>
                </Trigger>
            </Triggers>
            <Samples>100</Samples>
            <Configs>
                <SCHEDPARAMS_BIG_NR_RUN_PATH>/sys/kernel/msm_performance/notify/aggr_big_nr</SCHEDPARAMS_BIG_NR_RUN_PATH>
                <SCHEDPARAMS_AGGR_TOP_LOAD_PATH>/sys/kernel/msm_performance/notify/aggr_top_load</SCHEDPARAMS_AGGR_TOP_LOAD_PATH>
                <SCHEDPARAMS_REGISTER_SCHED_TRIGGERS>/sys/kernel/msm_performance/parameters/core_ctl_register</SCHEDPARAMS_REGISTER_SCHED_TRIGGERS>
                <SCHEDPARAMS_CLUSTER_TOP_LOAD_PATH>/sys/kernel/msm_performance/notify/top_load_cluster</SCHEDPARAMS_CLUSTER_TOP_LOAD_PATH>
                <SCHEDPARAMS_CLUSTER_CURR_CAP_PATH>/sys/kernel/msm_performance/notify/curr_cap_cluster</SCHEDPARAMS_CLUSTER_CURR_CAP_PATH>
            </Configs>
        </Meter>

        <Meter>
            <Name>Gpu</Name>
            <Triggers>
                <Trigger>
                   <Primary>true</Primary>
                   <AsyncId>VENDOR_HINT_ACTIVITY_START</AsyncId>
                   <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                    <Primary>true</Primary>
                    <AsyncId>VENDOR_HINT_ACTIVITY_PAUSE</AsyncId>
                    <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                    <Primary>true</Primary>
                    <AsyncId>VENDOR_HINT_ACTIVITY_RESUME</AsyncId>
                    <AsyncType>-1</AsyncType>
                </Trigger>

                <Trigger>
                   <Primary>true</Primary>
                   <AsyncId>VENDOR_HINT_ACTIVITY_STOP</AsyncId>
                   <AsyncType>-1</AsyncType>
                </Trigger>


            </Triggers>

            <Configs>
                <GPU_AVAILABLE_FREQUENCIES>/sys/class/kgsl/kgsl-3d0/gpu_available_frequencies</GPU_AVAILABLE_FREQUENCIES>
                <GPU_CLOCK_STATS>/sys/class/kgsl/kgsl-3d0/gpu_clock_stats</GPU_CLOCK_STATS>
                <GPU_CLK>/sys/class/kgsl/kgsl-3d0/gpuclk</GPU_CLK>
                <GPU_BUSY_PERCENTAGE>/sys/class/kgsl/kgsl-3d0/gpu_busy_percentage</GPU_BUSY_PERCENTAGE>
            </Configs>
            <Samples>100</Samples>
        </Meter>
    </Meters>

    <Triggers>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_THERMAL_UPDATE</AsyncId>
           <AsyncType>-1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_APP_WORKLOAD_TYPE</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>

        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_HEADROOM_REGULATOR</AsyncId>
           <AsyncType>-1</AsyncType>
        </Trigger>

        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_TAP_EVENT</AsyncId>
           <AsyncType>-1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_SENSOR_DATA</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_TOGGLE_GAMEOPT</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>

        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_PICARD_TOP_APP</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_PICARD_RENDER_RATE</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_PICARD_LOW_LAT</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_PICARD_HIGH_CPUUTIL</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>
        <Trigger>
           <Primary>true</Primary>
           <AsyncId>VENDOR_HINT_PICARD_LOAD_CHANGED</AsyncId>
           <AsyncType>1</AsyncType>
        </Trigger>
    </Triggers>
    <IgnoredApps target="taro">
        <App>com.google.android.gms</App>
        <App>com.android.vending</App>
        <App>com.google.android.projection.gearhead</App>
        <App>com.vectorunit.silver.googleplay</App>
        <App>com.kiloo.subwaysurf</App>
        <App>com.imangi.templerun2</App>
        <App>com.ogien.trainsim</App>
    </IgnoredApps>
    <IgnoredApps target="cape">
        <App>com.google.android.gms</App>
        <App>com.android.vending</App>
        <App>com.google.android.projection.gearhead</App>
        <App>com.vectorunit.silver.googleplay</App>
        <App>com.kiloo.subwaysurf</App>
        <App>com.imangi.templerun2</App>
        <App>com.ogien.trainsim</App>
    </IgnoredApps>
    <IgnoredApps target="diwali">
        <App>com.google.android.gms</App>
        <App>com.android.vending</App>
        <App>com.google.android.projection.gearhead</App>
    </IgnoredApps>
</Feature>
